package com.gsn.common;

import java.awt.Button;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.gsn.chooseChannel.ButtonShop;
import com.gsn.dataCommon.ConfigModel;
import com.gsn.desktop.engine.ActorUtility;

public class ShopGold extends Group {

	ButtonShop buttonShop[];
	public ShopGoldLayer parent;

	// public FlickScrollPane scroll;
	public ShopGold(ShopGoldLayer parent) {
		this.parent = parent;

	}

	public void init() {
		clear();
		int i;
		buttonShop = new ButtonShop[ConfigModel.shopModelList.length];
		for (i = 0; i < buttonShop.length / 2; i++) {
			buttonShop[i * 2] = new ButtonShop(i * 2, this);
			addActor(buttonShop[i * 2]);
			if (i * 2 + 1 < buttonShop.length)
				buttonShop[i * 2 + 1] = new ButtonShop(2 * i + 1, this);
			addActor(buttonShop[i * 2 + 1]);
			buttonShop[i * 2 + 1].x = buttonShop[i * 2].width * 1.1f;
			if (i != buttonShop.length / 2 - 1) {
				buttonShop[2 * i].y = (buttonShop.length / 2 - 1 - i) * buttonShop[0].height * 1.1f;
				if (i * 2 + 1 < buttonShop.length)
					buttonShop[2 * i + 1].y = (buttonShop.length / 2 - 1 - i) * buttonShop[0].height * 1.1f;

			}

		}

		width = buttonShop[0].width * 2.1f;
		height = (buttonShop.length / 2) * buttonShop[0].height + (buttonShop.length / 2) * buttonShop[0].height * 0.1f;

	}

	public void showParticle(Actor actor, float x, float y) {
		Vector2 v = ActorUtility.getCoordinate(actor, x, y, this);

		parent.showParticle(this, v.x, v.y);

	}
}
